This application claims the priority of Korean Patent Application No. 2002-36069, filed Jun. 26, 2002 in the Korean Intellectual Property Office, which is incorporated herein in its entirety by reference.
1. Field of the Invention
The present invention relates to an apparatus and a method for joint photographic expert group (JPEG) decoding, and more particularly, to a JPEG Huffman table decoder and a method thereof based on a binary search technique.
2. Description of the Related Art
A JPEG decoder decodes a compressed image based on a JPEG header and a Huffman table. As the size of the image increases, the performance of the JPEG decoder depends on the performance of the Huffman table. The Huffman table may have run-time configurable characteristics. Accordingly, the Huffman table is used to decode an image by comparing the symbols of the table configured in run-time and a target code stream by two bits.
However, the symbols are not fixed in such a decoding method, and therefore, a decoding method cannot be configured in hard-wired logic. In addition, in the case where the number of 16-bit symbols is more than the half of the number of symbols in the JPEG stream, comparisons may have to be performed as many as eight times on each symbol. Such a method requires a complicated and large midway search tree in order to support a two-bit comparison method.
Exemplary embodiments of the present invention provide a joint photographic expert group (JPEG) Huffman table decoder and a method thereof to reduce a comparison time for searching for symbols.
Exemplary embodiments of the present invention also provide a JPEG Huffman table decoder and a method thereof that require a reduced amount of memory.
According to an exemplary embodiment, the present invention is directed to a joint photographic expert group (JPEG) Huffman table decoder comprising a code book memory, a pre-processing unit, a symbol matching unit, and a post-processing unit. The code book memory stores code book data. The pre-processing unit receives JPEG code streams. The symbol matching unit performs symbol matching based on a binary search and calculates an address of the matched symbol in the code book memory. The post-processing unit calculates and outputs the level of the symbol.
In an exemplary embodiment, the symbol matching unit may include a first register, a second register, a comparator, a shifter, and an adder. The first register may store reference codes to be compared with the JPEG code streams. The second register may store location information on the reference codes stored in the first register. The comparator compares the JPEG code streams and the reference codes based on the binary search and determines the number of bits of the symbol in response to the comparison result. The shifter performs barrel shifting on the symbol. The adder calculates an address of the symbol in the code book data by using the output data of the shifter and the addresses of the reference codes, which are stored in the second register.
According to another exemplary embodiment, the present invention is directed to a JPEG Huffman table decoding method comprising receiving JPEG code streams, performing symbol matching based on a binary search to determine the number of bits of the symbol, performing barrel shifting according to the symbol matching result, generating an address in a code book memory storing a selected symbol, and calculating and outputting the level of the symbol.